import { statusOk, findByName, findById, nameById } from '../find'
import { getConsumerTime, setConsumerTime, removeConsumerTime } from '@/utils/auth'


// 主页广告图片数组
const state = getConsumerTime()

const getters = {
	statusOk,
	findByName,
	findById,
	nameById,
}


const mutations = {
	/**
	 * @example 功能：消费者可选上门时间
	 * @param {Array} data 可选上门时间数组
	 * @returns {} 无
	 */
	SET_INIT: (state, data) => {
		if (!Array.isArray(data)) return console.warn('消费者可选上门时间', data)
		setConsumerTime(data)
		state.splice(0, Infinity, ...data)
	},
}

export default {
	namespaced: true,
	state,
	getters,
	mutations,
}